package com.dongdongshop.controller;

import com.dongdongshop.data.Result;
import com.dongdongshop.domain.req.SellerReq;
import com.dongdongshop.domain.res.SellerRes;
import com.dongdongshop.service.SellerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("seller")
@RestController
public class SellerController {

    @Autowired
    private SellerService sellerService;

    @PostMapping("getSellerInfo")
    public Result<SellerRes> getSellerInfo(@RequestParam("sellerId")String sellerId){
        SellerRes sellerRes =sellerService.getSellerInfo(sellerId);
        return Result.success(sellerRes);
    }

    @GetMapping("queryAudits")
    public Result<List<SellerRes>> queryAudits() {
        List<SellerRes> sellerRes=sellerService.queryAudits();
        return Result.success(sellerRes);
    }

    @PutMapping("updateStatus")
    public Result updateStatus(@RequestBody SellerReq sellerReq){
        sellerService.updateStatus(sellerReq);
        return Result.success();
    }
}
